"use strict"
const user = {
  name: "向军"
};
Object.defineProperty(user, "name", {
  value: "后盾人",
  writable: false,
  enumerable: false,
  configurable: true
});

console.log(user)

// 不允许修改
// Cannot assign to read only property 'name' of object '#<Object>'
// user.name = "向军"; //Error
console.log(user.name)
console.log(Object.keys(user))


//不允许删除
// Uncaught TypeError: Cannot delete property 'name' of #<Object>
// console.log(delete user.name);
console.log(user);


// //不允许配置
// Uncaught TypeError: Cannot redefine property: name
// configurable：true 才能重新定义属性特征
var ret =Object.defineProperty(user, "name", {
  value: "后盾人",
  writable: true,
  enumerable: false,
  configurable: false
});

console.log(user == ret)
